<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>数组的方法-map</title>
</head>
<body>
  <script>
    /**
     * map: 映射，
     *  由一个数组得到一个新数组，并且新数组中每个元素与原数组的元素有一一对应的关系
     */

    // let nums = [1, 2, 3, 4]
    // let r = nums.map(item => {
    //   return item * item
    // })
    // let r = nums.map(item => item * item)
    // console.log(r)


    let list = [
      {
        id: 9,
        price: 18.8,
        name: '乒乓球拍'
      },{
        id: 20,
        price: 168,
        name: '篮球'
      },{
        id: 6,
        price: 99,
        name: '足球'
      },{
        id: 17,
        price: 138,
        name: '羽毛球'
      }
    ]
    // [18.8, 168, 99, 138]
    let r = list.map(obj => obj.price).filter(price => price >= 100)
    console.log(r)





  </script>
</body>
</html>